package com.LittleHan.crm.settings.service;

import com.LittleHan.crm.settings.dao.DicTypeDao;
import com.LittleHan.crm.settings.dao.DicValueDao;
import com.LittleHan.crm.settings.entity.DicType;
import com.LittleHan.crm.settings.entity.DicValue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Service("dicServiceImpl")
public class DicServiceImpl implements DicService{
    @Autowired
    @Qualifier(value = "dicTypeDao")
    DicTypeDao dicTypeDao;
    @Autowired
    @Qualifier(value = "dicValueDao")
    DicValueDao dicValueDao;


    public Map<String,List<DicValue>> getListDicValue(){
        Map<String,List<DicValue>> map=new HashMap<>();
        List<DicType> dicTypeList=dicTypeDao.getTypeList();
        for(DicType dict:dicTypeList){
            String code=dict.getCode();
            List<DicValue> dicValueList=dicValueDao.getValueList(code);
            map.put(code+"List",dicValueList);
        }
        return map;
    }
}
